using Holoville.HOTween;
using Photon;
using UnityEngine;

public class Parom : Photon.MonoBehaviour
{
	public Vector3 startPoint = Vector3.zero;

	public Vector3 endPoint = Vector3.zero;

	public float speedMove = 5f;

	public float timeDalay = 5f;

	public EaseType curEaseType = EaseType.EaseInOutCubic;

	private float timeMove = 10f;

	private bool isControlParom;

	private void Start()
	{
		HOTween.Init();
		if (settings.offlineMode || base.photonView.isMine)
		{
			base.transform.position = startPoint;
		}
		StartParom();
	}

	private void Update()
	{
		StartParom();
	}

	private void StartParom()
	{
		if (settings.offlineMode || base.photonView.isMine)
		{
			if (!isControlParom)
			{
				isControlParom = true;
				moveToEnd();
			}
		}
		else
		{
			isControlParom = false;
		}
	}

	private void moveToEnd()
	{
		timeMove = Vector3.Distance(endPoint, base.transform.position);
		timeMove /= speedMove;
		HOTween.To(base.transform, timeMove, new TweenParms().Prop("position", endPoint).Delay(timeDalay).Ease(curEaseType)
			.OnComplete(moveToStart));
	}

	private void moveToStart()
	{
		timeMove = Vector3.Distance(startPoint, base.transform.position);
		timeMove /= speedMove;
		HOTween.To(base.transform, timeMove, new TweenParms().Prop("position", startPoint).Delay(timeDalay).Ease(curEaseType)
			.OnComplete(moveToEnd));
	}
}
